package com.wondertek.poms.core.feign.callback;

import com.wondertek.poms.common.vo.ResultBean;
import com.wondertek.poms.core.feign.BcFeignClient;
import com.wondertek.poms.dao.vo.BcSendVo;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * <p><b>BcFeignClientFallback Description:</b> 播控回调默认类</p>
 * @author douzi
 * <b>DATE</b> 2020年11月30日 下午2:07:54
 */
@Slf4j
//@Component
public class BcFeignClientFallback implements FallbackFactory<BcFeignClient> {
    @Override
    public BcFeignClient create(Throwable cause) {
        // TODO Auto-generated method stub
        if (null != cause) {
            log.error("----FeignClient请求失败---->{}", cause.getMessage(), cause);
        }
        return new BcFeignClientFactory(){
            private static final String MSG = "%s-->请求播控接口失败！";
            @Override
            public ResultBean syncBc(BcSendVo osdpVo) {
                return ResultBean.error(String.format(MSG, "${charge-url.sync.bc}"));
            }

            @Override
            public ResultBean delbcRecord(Long prdContId) {
                return ResultBean.error(String.format(MSG, "${charge-url.del.bcrecord}"));
            }

//            @Override
//            public ResultBean oneKeyCheck(BcAssetPriorityVo bcAssetPriorityVo){
//                return  ResultBean.error(String.format(MSG, "${charge-url.one.key.check}"));
//            }
        };
    }
    public interface BcFeignClientFactory extends BcFeignClient{
    	
    }
}
